Skip to content

Conversation

@samsonasik
Copy link
Member

@samsonasik samsonasik commented Jul 11, 2025

@samsonasik
Copy link
Member Author

implemented 🎉 /cc @xHeaven

@samsonasik samsonasik closed this Jul 11, 2025
@samsonasik samsonasik reopened this Jul 11, 2025
@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba I am merging it ;)

@samsonasik samsonasik merged commit 6fae74e into main Jul 11, 2025
6 checks passed
@samsonasik samsonasik deleted the add-downgrade-array-all branch July 11, 2025 07:07
@samsonasik
Copy link
Member Author

@xHeaven the current functionality is only on assign expression -> foreach as it only mirror of the upgrade rule which apply foreach -> assign expression:

it doesn't accomodate on other statement, eg: return, if condition, etc. It may need to use ExprInTopStmtMatcher service, so it can prepend before the target statement

$exprArrayKeyFirst = $this->exprInTopStmtMatcher->match(
$node,
function (Node $subNode): bool {
if (! $subNode instanceof FuncCall) {
return false;
}
return $this->isName($subNode, 'array_key_first');
}
);

that can be next improvement when we have a use case later ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants